home *** CD-ROM | disk | FTP | other *** search
/ Total Network Tools 2002 / NextStepPublishing-TotalNetworkTools2002-Win95.iso / Archive / Misc Servers / Zope.exe / ZCATALOG.PY < prev    next >
Encoding:
Text File  |  2000-07-03  |  7.0 KB  |  217 lines

  1. ##############################################################################
  2. # Zope Public License (ZPL) Version 1.0
  3. # -------------------------------------
  4. # Copyright (c) Digital Creations.  All rights reserved.
  5. # This license has been certified as Open Source(tm).
  6. # Redistribution and use in source and binary forms, with or without
  7. # modification, are permitted provided that the following conditions are
  8. # met:
  9. # 1. Redistributions in source code must retain the above copyright
  10. #    notice, this list of conditions, and the following disclaimer.
  11. # 2. Redistributions in binary form must reproduce the above copyright
  12. #    notice, this list of conditions, and the following disclaimer in
  13. #    the documentation and/or other materials provided with the
  14. #    distribution.
  15. # 3. Digital Creations requests that attribution be given to Zope
  16. #    in any manner possible. Zope includes a "Powered by Zope"
  17. #    button that is installed by default. While it is not a license
  18. #    violation to remove this button, it is requested that the
  19. #    attribution remain. A significant investment has been put
  20. #    into Zope, and this effort will continue if the Zope community
  21. #    continues to grow. This is one way to assure that growth.
  22. # 4. All advertising materials and documentation mentioning
  23. #    features derived from or use of this software must display
  24. #    the following acknowledgement:
  25. #      "This product includes software developed by Digital Creations
  26. #      for use in the Z Object Publishing Environment
  27. #      (http://www.zope.org/)."
  28. #    In the event that the product being advertised includes an
  29. #    intact Zope distribution (with copyright and license included)
  30. #    then this clause is waived.
  31. # 5. Names associated with Zope or Digital Creations must not be used to
  32. #    endorse or promote products derived from this software without
  33. #    prior written permission from Digital Creations.
  34. # 6. Modified redistributions of any form whatsoever must retain
  35. #    the following acknowledgment:
  36. #      "This product includes software developed by Digital Creations
  37. #      for use in the Z Object Publishing Environment
  38. #      (http://www.zope.org/)."
  39. #    Intact (re-)distributions of any official Zope release do not
  40. #    require an external acknowledgement.
  41. # 7. Modifications are encouraged but must be packaged separately as
  42. #    patches to official Zope releases.  Distributions that do not
  43. #    clearly separate the patches from the original work must be clearly
  44. #    labeled as unofficial distributions.  Modifications which do not
  45. #    carry the name Zope may be packaged in any form, as long as they
  46. #    conform to all of the clauses above.
  47. # Disclaimer
  48. #   THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS ``AS IS'' AND ANY
  49. #   EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  50. #   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  51. #   PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL DIGITAL CREATIONS OR ITS
  52. #   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  53. #   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  54. #   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  55. #   USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  56. #   ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  57. #   OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  58. #   OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  59. #   SUCH DAMAGE.
  60. # This software consists of contributions made by Digital Creations and
  61. # many individuals on behalf of Digital Creations.  Specific
  62. # attributions are listed in the accompanying credits file.
  63. ##############################################################################
  64.  
  65. def manage_addZCatalog(self, id, title, vocab_id=None):
  66.     """
  67.  
  68.     Add a ZCatalog object.
  69.  
  70.     'vocab_id' is the name of a Vocabulary object this catalog should
  71.     use.  A value of None will cause the Catalog to create its own
  72.     private vocabulary.
  73.  
  74.     """
  75.  
  76.  
  77.  
  78.  
  79. class ZCatalog:
  80.     """
  81.  
  82.     ZCatalog object
  83.  
  84.     A ZCatalog contains arbitrary index like references to Zope
  85.     objects.  ZCatalog's can index either 'Field' values of object,
  86.     'Text' values, or 'KeyWord' values:
  87.  
  88.     Indexes
  89.  
  90.       Text -- Text indexes index textual content.  The index can be
  91.       used to search for objects containing certain words.
  92.  
  93.       Field -- Field indexes index atomic values.  The index can be
  94.       used to search for objects that have certain properties.
  95.  
  96.       Keyword -- Keyword indexes index sequences of values.  The index
  97.       can be used to search for objects that match one or more of the
  98.       search terms.
  99.  
  100.     Meta-data
  101.  
  102.       The ZCatalog can maintain a table of extra data about cataloged
  103.       objects.  This information can be used on search result pages to
  104.       show information about a search result.
  105.  
  106.       The meta-data table schema is used to build the schema for
  107.       ZCatalog Result objects.  The objects have the same attributes
  108.       as the column of the meta-data table.
  109.  
  110.     ZCatalog does not store references to the objects themselves, but
  111.     rather to a unique identifier that defines how to get to the
  112.     object.  In Zope, this unique identifier is the object's relative
  113.     path to the ZCatalog (since two Zope object's cannot have the same 
  114.     URL, this is an excellent unique qualifier in Zope).
  115.  
  116.     """
  117.  
  118.     __constructor__=manage_addZCatalog
  119.  
  120.     def catalog_object(self, obj, uid):
  121.         """
  122.  
  123.         Catalogs the object 'obj' with the unique identifier 'uid'.
  124.  
  125.         """
  126.  
  127.     def uncatalog_object(self, uid):
  128.         """
  129.  
  130.         Uncatalogs the object with the unique identifier 'uid'.
  131.  
  132.         """
  133.  
  134.     def uniqueValuesFor(self, name):
  135.         """
  136.  
  137.         returns the unique values for a given FieldIndex named 'name'.
  138.  
  139.         """
  140.  
  141.     def getpath(self, rid):
  142.         """
  143.         
  144.         Return the path to a cataloged object given a
  145.         'data_record_id_'
  146.         
  147.         """
  148.  
  149.  
  150.     def getobject(self, rid, REQUEST=None):
  151.         """
  152.         
  153.         Return a cataloged object given a 'data_record_id_'
  154.         
  155.         """
  156.  
  157.     def schema(self):
  158.         """
  159.  
  160.         Returns a sequence of names that correspond to columns in the
  161.         meta-data table.
  162.  
  163.         """
  164.  
  165.     def indexes(self):
  166.         """
  167.  
  168.         Returns a sequence of names that correspond to indexes.
  169.  
  170.         """
  171.  
  172.     def index_objects(self):
  173.         """
  174.  
  175.         Returns a sequence of actual index objects.
  176.  
  177.         """
  178.  
  179.     def searchResults(self, REQUEST=None, **kw):
  180.         """
  181.         
  182.         Search the catalog.  Search terms can be passed in the REQUEST
  183.         or as keyword arguments.
  184.  
  185.         
  186.         XXX search grammar, how terms are combined, special search
  187.         terms, format of returned results XXX
  188.  
  189.         """
  190.     
  191.     def __call__(self, REQUEST=None, **kw):
  192.         """
  193.         Search the catalog, the same way as 'searchResults'.
  194.         """
  195.  
  196.